Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
This PR refactors OpenDT from a bit of a monolithic app into a microservices setup. The codebase is now organized into four separate Docker services (
dashboard,dc-mock,sim-worker,kafka-init) plus a shared library for common code. Each service has its own Dockerfile and runs independently. All services have documentation with READMEs explaining how they work. The shared library (libs/common/) contains all the Pydantic models, Kafka utilities, and config management code that multiple services need.I also added a centralized config system using YAML files instead of using in-code constants at several places. There's a main
config/default.yamlfor global settings and separate configs for different experiments inconfig/experiments/. This makes it easier to manage different simulation scenarios.A new feature I added is the experiment management system. You can now run experiments with a simple
make experiment name=experiment_1command, and it automatically handles output directories, result tracking in Parquet files, and generation of plots comparing actual vs simulated power consumption. There's also a debug mode that saves all the OpenDC input/output files if you need to troubleshoot.The simulation engine got some nice upgrades. It now caches results to avoid re-running identical simulations and uses heartbeat messages for reliable window processing.
Finally, I added a Makefile with commands for everything -
make upto start services,make logs-sim-workerto view logs,make experimentto run experiments, etc. Services support hot reload during development, so you don't need to rebuild containers every time you change code.